<table class="am-table am-table-bordered am-table-striped am-table-compact" id="result-table">
    <thead>
    <tr>
      <th width="60px">号码</th>
      <th width="50px">头像</th>
      <th width="120px">手机</th>
      <th width="100px">真实姓名</th>
      <th width="100px">积分余额</th>
      <th width="80px">加入时间</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>
    </tbody>
</table>
<style type="text/css">
    #result-table img {
        width: 40px;
        height: 40px;
        border: 1px solid #ccc;
    }
</style>

<script>
    // 等待一切就绪
    waitOk(function() {
        if (!GroupUtil.group) return;
        CMD.query_group_members(GroupUtil.group.id, function(list) {
            GroupUtil.group.list = list;
            fillMembers(list);
        });
    });

    function fillMembers(list) {
        var table = $("#result-table tbody");
        table.empty();

        for (var i in list) {
            var o = list[i];
            var tr = $("<tr></tr>");
            tr.append('<td>' + o.user.code + '</td>');
            tr.append('<td><img src="' + o.user.portrait + '"></td>');
            tr.append('<td>' + (o.user.mobile || '') + '</td>');
            tr.append('<td>' + (o.user.name || '') + '</td>');
            tr.append('<td><span class="balance" value="' + o.user.mobile + '"></span></td>');
            tr.append('<td>' + new Date(o.join).Format("yyyy-MM-dd") + '</td>');
            if (o.user.id == GroupUtil.group.owner) {
                tr.append('<td>群主</td>');
            }
            else {
                var line = '<td value="__member_id__">' +
                '<button class="kickout">踢出群</button>' +
                '</td>';
                line = line.replace(/__member_id__/, o.id);
                tr.append(line);
            }
            table.append(tr);
        }
        _queryBalance();
    }

    function _queryBalance()
    {
        var arr = $("#result-table span.balance");
        for (var i = 0; i < arr.length; i++) {
            var k = $(arr[i]);
            if (k.html() !== '') continue;
            CMD.account_gquery_uid(k.attr("value"), function(r) {
                if (r.list.length > 0) {
                    k.html(r.list[0].balance/100);
                    _queryBalance();
                }
                else {
                    k.html(0);
                    _queryBalance();
                }
            });
            break;
        }
    }
</script>
   